//
//  DynamicColumnFieldCore.h
//  
//
//  Created by wjxfhxy on 15/12/30.
//
//

#import "ExpandDynamicCell.h"

#import "PositionGroupTableViewCell.h"
#import "TextAreaGroupTableViewCell.h"
#import "MultiSelectGroupTableViewCell.h"
#import "DateTimeGroupTableViewCell.h"
#import "ImagePanelGroupTableViewCell.h"
#import "MixedPanelGroupTableViewCell.h"

#import "MultiSelectViewController.h"
#import "SwitchSelectGroupTableViewCell.h"
#import "CreateUUIDGroupTableViewCell.h"

#define DatePickPanelViewControllerTag          800000

#define DateTimePickPanelViewControllerTag          900000

#define DicPickPanelViewControllerTag       1000000
#define OtherPickPanelViewControllerTag       11000000

typedef NS_ENUM(NSUInteger,DynamicColumnFieldViewType)
{
    DynamicColumnFieldViewTypeAdd,
    DynamicColumnFieldViewTypeModify,
    DynamicColumnFieldViewTypeReview
};

@class DynamicColumnFieldCore;

@protocol DynamicColumnFieldCoreDataSource <NSObject>

- (DynamicColumnFieldViewType)typeOfDynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore;

@optional

- (id)packObjOfDynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore;

- (XMSQueueDictionary*)transformMapOfDynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore;

- (XMSQueueDictionary*)constraintOfDynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore;

- (id)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore formatDynamicColumnCellValue:(id)value fieldDescript:(FieldDescript*)fieldDescript;

@optional

- (NSString*)headImagePathOfDynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore;

- (NSString*)headImageCacheFolderOfDynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore;

@end

@protocol DynamicColumnFieldCoreDelegate <NSObject>

- (UIView*)superViewOfDynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore;

@optional

- (CGFloat)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore dynamicColumnCellWillCaleHeight:(FieldDescript*)fieldDescript;

- (ExpandDynamicCell*)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore dynamicColumnCellWillCreate:(FieldDescript*)fieldDescript;

- (void)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore dynamicColumnCell:(ExpandDynamicCell*)cell didCreate:(FieldDescript*)fieldDescript;

- (BOOL)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore handlerDynamicColumnCellDidSelected:(FieldDescript*)fieldDescript;

- (NSDictionary*)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore willPushViewControllerParam:(NSDictionary*)param inFieldDescript:(FieldDescript*)fieldDescript;

@optional

- (NSInteger)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore pickerDefaultRowInFieldDescript:(FieldDescript*)fieldDescript;

- (NSInteger)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore pickerNumberOfRowInFieldDescript:(FieldDescript*)fieldDescript;

- (NSString*)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore pickerPlaceholder:(NSString*)placeholder inFieldDescript:(FieldDescript*)fieldDescript;

- (BOOL)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore hiddenPickerPlaceholderInFieldDescript:(FieldDescript*)fieldDescript;

- (NSString*)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore pickerTitleForRow:(NSInteger)row inFieldDescript:(FieldDescript*)fieldDescript;

- (NSString*)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore pickerSelectedTitleAtIndex:(NSInteger)nIndex inFieldDescript:(FieldDescript*)fieldDescript;

- (void)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore pickerDidChangeSelectedTitle:(NSString*)oriTitle toNewTitle:(NSString*)newTitle inFieldDescript:(FieldDescript*)fieldDescript;

- (NSDate*)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore datePickerDefaultDate:(NSString*)dateString fieldDescript:(FieldDescript *)fieldDescript;

- (NSString*)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore dateTimeFormatInFieldDescript:(FieldDescript *)fieldDescript;

@optional

- (void)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore didSelectedSwitchSelectGroupTableCell:(FieldDescript*)fieldDescript;

- (void)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore didClickedClearButtonOfDropDownGroupTableViewCell:(DropDownGroupTableViewCell*)cell;

@optional

- (void)showProgressView:(NSString*)title;

- (void)hideProgressView;

@optional

- (void)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore textFieldDidBeginEditingOfTextInputGroupTableViewCell:(TextInputGroupTableViewCell *)cell;

- (void)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore textFieldDidEndEditingOfTextInputGroupTableViewCell:(TextInputGroupTableViewCell*)cell;

@optional

- (id)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore groupTitleInGroup:(NSUInteger)group;

- (CGFloat)dynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore heightForHeaderInGroup:(NSInteger)group;

@optional

- (CGRect)frameOfDynamicColumnFieldCore:(DynamicColumnFieldCore*)dynamicColumnFieldCore;

@optional
-(void)groupTableViewWillBeginDragging:(XUIGroupTableView *)groupTableView;

@end

@interface DynamicColumnFieldCore : NSObject
{
    XUIGroupTableView *_gtable;
}

@property(nonatomic,weak) id<DynamicColumnFieldCoreDataSource> dataSource;
@property(nonatomic,weak) id<DynamicColumnFieldCoreDelegate> delegate;

@property(nonatomic,readonly,strong) ExpandDynamicCell *textInputViewCell;

@property(nonatomic,readonly,strong) ExpandDynamicCell *selectedCell;

- (void)loadView;

- (void)unloadView;

- (void)reloadDyanmicField;

- (XUIGroupTableView*)getGrouptableView;

@end
